<?php

/**
 * This is the model class for table "pasusiasuburhamil".
 *
 * The followings are the available columns in table 'pasusiasuburhamil':
 * @property integer $psubh_id
 * @property integer $psubh_kec
 * @property integer $psubh_hamil
 * @property integer $psubh_nohamil
 * @property double $psubh_jumlah
 * @property integer $psubh_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $psubhKec
 */
class Pasusiasuburhamil extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Pasusiasuburhamil the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pasusiasuburhamil';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('psubh_kec, psubh_hamil, psubh_nohamil, psubh_tahun', 'numerical', 'integerOnly'=>true),
			array('psubh_jumlah', 'numerical'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('psubh_id, psubh_kec, psubh_hamil, psubh_nohamil, psubh_jumlah, psubh_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'psubhKec' => array(self::BELONGS_TO, 'Kecamatan', 'psubh_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'psubh_id' => 'Psubh',
			'psubh_kec' => 'Psubh Kec',
			'psubh_hamil' => 'Psubh Hamil',
			'psubh_nohamil' => 'Psubh Nohamil',
			'psubh_jumlah' => 'Psubh Jumlah',
			'psubh_tahun' => 'Psubh Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('psubh_id',$this->psubh_id);
		$criteria->compare('psubh_kec',$this->psubh_kec);
		$criteria->compare('psubh_hamil',$this->psubh_hamil);
		$criteria->compare('psubh_nohamil',$this->psubh_nohamil);
		$criteria->compare('psubh_jumlah',$this->psubh_jumlah);
		$criteria->compare('psubh_tahun',$this->psubh_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}